package com.cloudm.technician.cloudm_box.regular

import org.junit.Assert
import org.junit.Test
import java.util.regex.Pattern

/**
 * 作者: wesley
 * 时间: 2017/12/29
 * 描述: 正则测试
 */
class RegularTest {


    @Test
    fun testIsSnCode(){
        val regex_1 ="\\d{6}\\d{2}[A-Z]\\d{7}"
        val regex = "(\\d{2})+(\\d{6})+([A-Z]{1})+(\\d{7})"
        val value = "04201709B0000013"
        val isMatch = Pattern.compile(regex_1).matcher(value).matches()

        Assert.assertTrue(isMatch)
    }


    @Test
    fun testIsLicense(){
        val regex = "[A-Z]{2}\\d{5}"
        val value = "QJ10101"
        val isMatch = Pattern.compile(regex).matcher(value).matches()

        Assert.assertTrue(isMatch)
    }
}